class Productor < ActiveRecord::Base

  attr_accessible :nombre, :direccion, :telefono, :email, :logo_productor

  has_many :productos

  has_attached_file :logo_productor, styles: { medium: '200x200>', thumb: '48x48>' }

  validates_length_of :nombre, :in => 1..255
  validates_length_of :direccion, :in => 1..255
  validates_numericality_of :telefono
  validates_format_of :telefono, :with => /[0-9]{9}/
  validates_format_of :email, :with => /^([\da-z_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/

end
